package net.fpeg.kotlin.msa.auth.controller

import net.fpeg.kotlin.msa.auth.dto.WordUserDto
import net.fpeg.kotlin.msa.auth.service.InfoService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestHeader
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/info")
class InfoController {
    @Autowired
    lateinit var infoService: InfoService

    @GetMapping
    fun get(
            @RequestHeader("USER_ID") uid: Long
            ) = WordUserDto(infoService.getOne(uid).username)
}